import java.io.BufferedWriter;
import java.io.FileWriter;
import java.util.ArrayList;




public class Utility {
	
	public static void CreateFiles(ArrayList<Integer> episodesSteps, ArrayList<Integer> episodesCollReward){
	
		try{
			  // Create file 
			  FileWriter fstream = new FileWriter("episodeVSnbsteps.txt");
			  BufferedWriter out = new BufferedWriter(fstream);
			  
			  for(Integer i =0 ; i < episodesSteps.size(); i++)
				  out.write( (i+1) + " " + episodesSteps.get(i)+ "\n");
			
			  out.close();
			  
			  // Create file 
			  fstream = new FileWriter("episodeVcollReward.txt");
			  out = new BufferedWriter(fstream);
			  
			  for(Integer i =0 ; i < episodesCollReward.size(); i++)
				  out.write( (i+1) + " " + episodesCollReward.get(i)+ "\n");
			
			  out.close();
			  
			  }catch (Exception e){//Catch exception if any
			      System.err.println("Error: " + e.getMessage());
			  }
	}
	
	public static int teller = 1;

	public static void writePath(ArrayList<String> pathGoal){
		
		try{
			  // Create file 
			  FileWriter fstream = new FileWriter("path"+ teller++ + ".txt");
			  BufferedWriter out = new BufferedWriter(fstream);
			  String temp;
			  
			  for(String path : pathGoal){
				  
				  if(path.equals("(NORTH)"))
						temp = "NORTH";
				  else if(path.equals("(EAST)"))
					  temp = "EAST";
					else if(path.equals("(SOUTH)"))
						temp = "SOUTH";
					else /*if(path.equals("(WEST)"))*/
						temp = "WEST";
				  
				  out.write( temp + "\n");
			  }
			
			  out.close();
			  
			 
			  
			  }catch (Exception e){//Catch exception if any
			      System.err.println("Error: " + e.getMessage());
			  }
	}


}
